package com.ctg.itrdc.imageconsole.control.sys;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

/**
 * 
 * @description: 前端页面登陆未集成，未了测试模拟登陆， 拦截器，每次 请求判断session是有用户信息，没有设置用户信息， 
 * @version: v1.0.0 
 * @author: FFSC-CHENSS
 * 
 * Modification History:
 * Date               Author      Version     Description
 * -----------------------------------------------------------------
 * 2016年3月22日 下午11:41:47     FFSC-CHENSS       v1.0.0        create
 *
 */
public class SystemUserInterceptor implements HandlerInterceptor {

	@Override
	public void afterCompletion(HttpServletRequest arg0,
			HttpServletResponse arg1, Object arg2, Exception arg3)
			throws Exception {
		
	}

	@Override
	public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1,
			Object arg2, ModelAndView arg3) throws Exception {
		// TODO Auto-generated method stub
	}

	@Override
	public boolean preHandle(HttpServletRequest arg0, HttpServletResponse arg1,
			Object arg2) throws Exception {
//		HttpSession session = arg0.getSession();
//		SystemUserDTO systemUser = (SystemUserDTO)session.getAttribute(CommonConstant.SessionKey.SYSUSER);
//		if(systemUser == null){
//			SystemUserDTO systemUser2 = new SystemUserDTO();
//			systemUser2.setTenantId(2l);
//			systemUser2.setStaffId(1l);
//			systemUser2.setCreateStaff(2l);
//			systemUser2.setSysUserId(1L);
//			systemUser2.setSysUserCode("USER");
//			session.setAttribute(CommonConstant.SessionKey.SYSUSER, systemUser2);
//		}
		return true;
	}

}
